/**
 *  cpu.h - Data types and Related Calls about ARM7TDMI core.
 *          Those are what need to overrided when port Bycore to
 *          other architectures.
 *
 *  Copyright (C) 2008  ZhangHu
 *  All rights reserved.
 *  E-MAIL: anmnmnly@gmail.com
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef __CPU_H__
#define __CPU_H__

#define byte_t   signed char
#define ubyte_t  unsigned char
#define word_t   signed int
#define uword_t  unsigned int
#define sword_t  signed short
#define usword_t unsigned short
#define lword_t  signed long
#define ulword_t unsigned long
#define char_t   char
#define uchar_t  unsigned char
#define double_t double
#define float_t  float
#define bool_t   unsigned char


#ifdef loff_t
#undef loff_t
#define loff_t ulword_t
#else
#define loff_t ulword_t
#endif

/* Define the stack operating style, UP=1; DOWN=0 */
#define UP 1
#define DOWN 0
#define FULL 1
#define EMPTY 0
#define STACK DOWN


void init_context(word_t *pstk); /* Initialize task stack */
void init_tick(void);           /* Initialize a CPU timer as tick for Bycore */

/* The following subrutines were implemented in cpu_a.s */
__swi(0x00)void TaskSwitch(void);   /* Switch two task under system mode */
void TaskStart(void);    /* Make a task start to run */
void TaskIntStart(void); /* Make a task start to run under interruption mode */
void TaskIntSw(void);    /* Switch two task under interruption mode */
void TaskContinue(void); /* Task continues to run after interruption */
void DisableInt(void);   /* Diable interruption */
void EnableInt(void);    /* Enable interruption */

#endif

